package Users.Role;

import Users.User;
import service.impl.*;

public class NormalUsers extends User {
    String name;
    public NormalUsers(String name) {
        this.name = name;
    }
    /**
     * 为普通用户赋予相应权限
     */
    static {
        operations.add(new FindBookInfoIOperation());
        operations.add(new BorrowBookIOperation());
        operations.add(new ReturnBookIOperation());
    }

    /**
     * 设置普通用户界面
     * @return
     */
    @Override
    public int UI() {
        System.out.println("***************************************************");
        System.out.println("1.查询所有图书信息.");
        System.out.println("2.借阅图书.");
        System.out.println("3.归还图书.");
        System.out.println("4.退出系统.");
        System.out.println("请输入相应序号来进行序号对应的操作！");
        System.out.println("***************************************************");
        int operation = scanner.nextInt();
        if (operation == 4) {
            // 关闭输入流！
            scanner.close();
        }
        return operation;
    }
}
